package com.example.Mapper;


import com.example.entity.Users;
import com.example.entity.vo.UsersVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UsersMapper {
    Users findOneByUsername(String userName);

    List<UsersVo> selectAll(UsersVo usersVo);

    @Delete("delete from users where userId=#{userId}")
    int deletById(Integer userId);

    @Insert("insert into users values(null,#{userName},#{userPassword},#{userRealName},#{userSex},#{userMobile},#{userEmail},#{isLock},#{deptId},#{deptName},#{roleId},now(),null)")
    int insertUser(Users users);

    @Update("update users set userName=#{userName},userPassword=#{userPassword},userRealName=#{userRealName},userSex=#{userSex},userMobile=#{userMobile},userEmail=#{userEmail},isLock=#{isLock},deptId=#{deptId},deptName=#{deptName},roleId=#{roleId},createTime=#{createTime},updateTime=now() where userId=#{userId}")
    int updateUser(Users users);
}